package cn.com.xjnt.vas.manage.domain.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the sys_dict_classify database table.
 * 
 */
@Entity
@Table(name = "sys_dict_classify")
@NamedQuery(name = "DictClassify.findAll", query = "SELECT d FROM DictClassify d")
public class DictClassify extends com.frameworks.core.entity.IdEntity {
	private static final long serialVersionUID = 1L;

	@Column(nullable = false, length = 60)
	private String name;

	@Column(nullable = false, length = 60)
	private String code;

	@Column(length = 225)
	private String description;

	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate;

	@Temporal(TemporalType.TIMESTAMP)
	private Date modifyDate;

	@OneToMany(mappedBy = "dictClassify", cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, orphanRemoval = true)
	private List<DictData> dictData = new ArrayList<DictData>(0);

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

	public List<DictData> getDictData() {
		return dictData;
	}

	public void setDictData(List<DictData> dictData) {
		this.dictData = dictData;
	}
	
	@PrePersist
	public void onCreate(){
		this.createDate = this.modifyDate = new Date();
	}
	
	@PreUpdate
	public void onUpdate(){
		this.modifyDate =  new Date();
	}

}